#!/usr/bin/env bash

set -e

cd /opt/app || exit 1

export HOME=/home/ec2-user
export MIX_ENV=prod

source /etc/environment

mix local.rebar --force
mix local.hex --force

mix deps.get

mix compile

# Install node dependencies
pushd apps/explorer || exit 1
npm install
popd

chown -R ec2-user:ec2-user /opt/app

exit 0
